﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using _3Sixty.Maverick.Models;
using ThreeSixty.Maverick;
using ThreeSixty.Maverick.Models;

namespace _3Sixty.Maverick.Controllers
{
    public class ThreadController : Controller
    {
        ThreadRepositories _repositories = new ThreadRepositories();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="title"></param>
        /// <returns></returns>
        public ActionResult Index(int id, string title)
        {
            Thread thread = _repositories.ThreadByIDTitleGet(id, title);

            if (thread != null)
            {
                return View("Thread", thread);                    
            }

            return View("Thread");
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ActionResult Post(int id, string title)
        {
            Thread thread = _repositories.ThreadByIDTitleGet(id, title);

            if (thread != null)
            {
                return View("Post", thread);
            }

            return View("Error");
        }

    }
}
